package com.my.jli.Service.impl;

import com.my.jli.Service.NoticeService;
import com.my.jli.dao.NoticeRepository;
import com.my.jli.entity.Notice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @ClassName NoticeServiceImpl
 * @Description
 * @Author MaYu
 * @Date 2022/5/4 16:19
 * @Version 1.0
 **/
@Service
public class NoticeServiceImpl implements NoticeService {
    private NoticeRepository noticeRepository;
    @Autowired
    public void setNoticeRepository(NoticeRepository noticeRepository) {
        this.noticeRepository = noticeRepository;
    }

    @Override
    @Transactional(propagation = Propagation.REQUIRED)
    public Notice addNotice(Notice notice) {
        return noticeRepository.save(notice);
    }
}
